<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:body>
        <ui:composition template="../communityTemplate.xhtml">
            <ui:define name="content">
                <h:form>


                    <p:panel>
                        <h:panelGrid columns="3">
                            <h:outputText value="Username: "/>
                            <p:inputText id="usernameBox" value="#{registerBean.name}" required="true">
                                <f:validateLength minimum="3" maximum="44"/>
                            </p:inputText>
                            <p:message id="msg1" for="usernameBox" display="text" showDetail="FALSE" showSummary="TRUE"/>


                            <h:outputText value="Email: "/>
                            <p:inputText id="emailBox" value="#{registerBean.email}" required="true">
                                <f:validateLength minimum="3" maximum="44"/>
                                <f:validateRegex pattern="^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$"/>
                            </p:inputText>
                            <p:message id="msg2" for="emailBox" display="text" showDetail="FALSE" showSummary="TRUE"/>


                            <h:outputText value="Password: "/>
                            <p:password id="passwordBox" value="#{registerBean.password}" minLength="8" feedback="true" required="TRUE" maxlength="255">
                                <f:validateLength maximum="255" minimum="3"/>
                            </p:password>
                            <p:message id="msg3" for="passwordBox" display="text" showDetail="FALSE" showSummary="TRUE"/>

                            <h:commandButton value="Register" action="#{registerBean.registerUser()}"/>
                        </h:panelGrid>

                    </p:panel>

                </h:form>  
            </ui:define>
        </ui:composition>
    </h:body>


</html>

